/*
 * @Author: gmh
 * @Date: 2024-03-05 13:52:48
 * @Description: 地址信息持久化
 */
import type { AddressItem } from '@/types/address'
import { defineStore } from 'pinia'
import { ref } from 'vue'

// 定义 Store
export const useAddressStore = defineStore('address', () => {
  // 选中的收货地址
  const selectedAddress = ref<AddressItem>()

  // 修改选中的收货地址
  const changeSelectedAddress = (val: AddressItem) => {
    selectedAddress.value = val
  }

  return {
    selectedAddress,
    changeSelectedAddress,
  }
})
